﻿/// Copyright © 2013 Microsoft Corporation. 
/// This project is released under the Microsoft Public License (MS-PL)
///
using System.Net;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Azure.Performance.Storage.Tests
{
    [TestClass]
    public class StorageUploadTests

{
    [TestMethod]
    public void CanUploadSdk20WritePages()
    {
        var uploadLib = new UploadPerformanceTestSdk20WritePages();
        var file = TestFile.GetFile(7);

        ServicePointManager.UseNagleAlgorithm = false;
        ServicePointManager.Expect100Continue = false;
        ServicePointManager.DefaultConnectionLimit = 120;

        uploadLib.Threads = 8;
        uploadLib.Initialize(GetConnectionString());
        
        //TODO:  Download the file and compare a hash of uplaod to downloaded
        uploadLib.Upload(file);
        uploadLib.Clean();
    }

    [TestMethod]
    public void CanUploadSdk20Stream()
    {
        var uploadLib = new UploadPerformanceTest();
        var file = TestFile.GetFile(7);

        ServicePointManager.UseNagleAlgorithm = false;
        ServicePointManager.Expect100Continue = false;
        ServicePointManager.DefaultConnectionLimit = 120;

        uploadLib.Threads = 8;
        uploadLib.Initialize(GetConnectionString());

        //TODO:  Download the file and compare a hash of uplaod to downloaded
        uploadLib.Upload(file);
        uploadLib.Clean();
    }

    private string GetConnectionString()
    {
        return System.Configuration.ConfigurationManager.AppSettings["Application.Storage"];
    }
}
}
